'use strict';

const Controller = require('egg').Controller;

class SearchController extends Controller {
  async index() {
    const {ctx} = this;
    var {keyword} = ctx.query;
    const res = await ctx.service.movies.getMovieDetailOrSearch({keyword:keyword});
    if(res.length){
      ctx.body = {
        status:200,
        res,
      };
    }else{
      ctx.body = {
        status:400,
        msg:'输入参数不合法'
      }
    }
  }
}

module.exports = SearchController;
